package dao

import (
	menu "yundian/internel/app/models/menus"
	"yundian/internel/pkg/dingo"
	"yundian/internel/pkg/dingo/global"
)

func GetUserNavList(roleId int) *dingo.ErrorWrap {
	m := make([]*menu.MenusModel, 0)
	sql := "select * from menus m " +
		"right join role_menu rm on m.id = rm.menu_id " +
		"where rm.role_id = ?"
	db := global.Orm.Raw(sql, roleId).Find(&m)
	return dingo.ErrorIf(db.Error, m)
}
